/*----------------------------------------------------------------------------
Owner(s): Shane Whitfield
$Copyright: $
$Id: 

----------------------------------------------------------------------------*/

#include "subsystem.h"

/*--------------------------------------------------------------------------*/
// Class CSubsystem implementation.

CSubsystem::CSubsystem(const char* i_name)
{
	m_name = i_name;
}

void CSubsystem::DispatchInit()
{
	OnInit();
	m_initialized = true;
	broadcastChildren(&CSubsystem::DispatchInit);
}

void CSubsystem::AddChildSubsystem(CSubsystem* i_child)
{
	m_children.push_back(i_child);
}

void CSubsystem::DispatchPostInit()
{
	OnPostInit();
	m_postInitialized = true;
	broadcastChildren(&CSubsystem::DispatchPostInit);
}

void CSubsystem::broadcastChildren(DispatchProc i_dispatchProc)
{
	for (int iSystem = 0; iSystem < m_children.size(); ++iSystem)
	{
		((m_children[iSystem])->*i_dispatchProc)();
	}
}

/*-----------------------------------EOF!-----------------------------------*/
